package com.pay.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */


public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "9021000140668656";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCLcQ/WTTy/ButYnmubjMgY3HMKSTqSA+L8OwsD2tJUEZrbo6BQxdx6XgeNyWL+SR4tzW3gHfTNJNDXJCmjgmtzJeovzSk57qsgHijiyL/ekNr/Ki4m454V3E0cTqVejBEbz6n84Rl5+ZyuQdqj4X36PMrwnWRcLehFvDdL70sDhdUnRqDuu48fW9IE9UxtQdqG827KAIF42TnkeWNUOD81u99fnuiKwjutISoavMYndtBj4sXZXCYXuGm3iaXA7wWTN5EBSqFMulNpmPYA22Hh5+IpGOhwLZgBi0WQ7tkhrdG9H2ODIt69cBbREJVgVnaebX2llUHdAydgZt3OP+DPAgMBAAECggEAPm/MuJdzCNIvVUnyQv9BpagoNsXdXP4yh+BkKUC1BwGvBoP4x9IgzAYIedtf4R6aTcX7Wevv7l96x6qgnl9Kf4/NkcPant8YbtQyWIGtMBpKhRC9A5rN8VnoiTFJ6NDs5DgTFHEyeCRlnL1OCi1wvDi2YhEHnCLOK1OAqxalzxhV67mmeECLnqbdMVQV48ebBqLYPHX7o3BBWdy0DDdDDxATR7/b8xcdqyG41anja/rX+CKnnb6qmDjsswuCfncrd/+wdkOYvpXKyK4Z7y+FTpSk4BjUe03fJW1HmsKHvcWT69pNSdLEAkltTTvW8GZTf3I1XjgtEB8ncSidFswN6QKBgQDbNhHEoHTTkbNwktO8DJIAQZl4V72W2DA8XdZTxTx+k1fWtZo3QOG9gE3z29XpKHajIkLUUBubohLyPjtOV/i063nw7Z/mrvZkKWDST8wRo0GafYKxpcrLk/t+EFcfwvTRlgKAMPFo54eZ+65Pud8BpyxIHZ0zy/QO3k8B7biv1QKBgQCi194ZxAwpgaZJzXnCfQa3m++wv8vwv32v7Tp4zZ4b2PuveTdWOt8U65XFO/Sg8U1QJtiSZksaOFb0AaPJUSG1NE5U6/Jpkg/jtsAn1TvEAjqZG/XtMgWJg4h+oc2SXznRprJO27k2fdimF2MOQsBRqZ/JFPDdM7d8g99TlN2EEwKBgQDRIhh5eot6fPqwX6PZODTiQbNk+HBLxRzfuraLXRSFvZSDpuXl6OR0oj+8cvL1akElCb6wR2zPYiSpL23tJEiGclD35fwzXKB8lm1kt/R8r0AbX7qcOQvshNXeQ0CbcKeYfIEOQ6NM7faUlWSLc0yqiw7YDki37dB9juHZeS5FsQKBgQCQHPiK1uxogzu1zul1zI34SkFqq6KB0gYafpijtly5imLbHSxy3LD2Y7NtFK1fDY39ZBOAJJVMhBW35gecL3fkVIEKOLGU6lWzkdUmq1g0FEDlpVAUdZNe6pAOeYVjh3C08JCWp2+XIPJtsv7P7RUkcDhfjW/IY297+3zWDEWqDwKBgBWXVfZxInguTo0yJzojZdwFRuXiMjbsbNspHQ34pTAMuizz2ZX6jl/pb8rEKhgDs42Kiq7JfhfykfznWzmDnCYS7Pk2kj1bDSOyUvPHmP3GQBUogEN/YmdYPS4NIjaa+qsIlWTghNdE6HGtOphdD1zGbsPT8RSK4oONBy1itRA6";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjXBPmeo6aIlrW4PVWxjOZQ+lVdmeK+vMUH1HrbWlXIWi70bZWLpEl6J573c7dnp9G/g5zFQoWeMTE5WH9Grq/Oz+Pqjjw/zVkGV/7HYGwxeA53EJwfi+lYA7miQ7sr2VIwLstbqM/pTs2GkHDkIU3hyYEHcqsz88WNAepZagpl37TdY/tz/qpkbfbmaZEGHmrrn4OKQZwvyN6kRKGkJAhBtRoKzYvpKDFq16gfElX2rw6urzace0ZygGbB4D2JG5BWEEj6XDux4xMvsy2JNOv1y8ZdN5lrsDNFbxA/yMRgw4XcF1tKW0wMRMgW2CzeVAuJaDybMCLfbFy2fuP/SwYwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/pay/page/nofity";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/pay/page/return";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";
    // 返回格式
    public static String FORMAT = "json";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";

    // 日志记录目录
    public static String log_path = "/log";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
//    public static void logResult(String sWord) {
//        FileWriter writer = null;
//        try {
//            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
//            writer.write(sWord);
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            if (writer != null) {
//                try {
//                    writer.close();
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }
}

